package com.bestescortbedsystem.controller.feedback;

import com.bestescortbedsystem.service.FeedbackService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("feedback")
public class FeedbackController {
    @Resource
    private FeedbackService feedbackService;

    //查
    @RequestMapping("list")
    public Map<String,Object> feedbackList(String minTime,String maxTime,String pageNumber){
        Map<String,Object> map=new HashMap<>();
        Integer pageSize=10;
        try{
            map=feedbackService.getAllFeedback(minTime,maxTime,pageNumber,pageSize);
            map.put("result",true);
        }catch (Exception e){
            map.put("result",false);
        }finally {
            return map;
        }
    }
    //删
    @RequestMapping("delete")
    public Map<String,Object> deleteFeedback(String userfeedbackId){
        Map<String,Object> map=new HashMap<>();
        try{
            feedbackService.deleteFeedback(userfeedbackId);
            map.put("result",true);
        }catch (Exception e){
            map.put("result",true);
        }finally {
            return map;
        }
    }
}
